FROM alpine:latest
MAINTAINER "The Alpine Project" <admin@jiobxn.com>
ARG JDK="8"

RUN apk update --no-cache && apk add openjdk${JDK} openssl tzdata bash --no-cache

ARG LATEST="0"

WORKDIR /apps

COPY target/demo-1.0.jar /apps/demo-1.0.jar
#COPY start.sh /apps/start.sh
RUN echo -e '#!/bin/bash\nexec java -jar -Xms${MEM:-128}M -Xmx${MEM:-128}M /apps/demo-1.0.jar > /apps/logs/demo.log' >/apps/start.sh
RUN chmod +x /apps/start.sh

EXPOSE 12345

#ENTRYPOINT ["/apps/start.sh"]

CMD ["/apps/start.sh"]

# docker build --build-arg LATEST=$RANDOM -t demo .
# docker run -d --restart unless-stopped -v /docker/app-logs/demo:/apps/logs -p 12345:12345 --name demo demo